<?php
/*
Template Name: Document Center Page
*/
?>

<?php
/**
 * The template for displaying all pages.
 *
 * This is the template that displays all pages by default.
 * Please note that this is the WordPress construct of pages
 * and that other 'pages' on your WordPress site will use a
 * different template.
 *
 * @package WordPress
 * @subpackage Twenty_Twelve
 * @since Twenty Twelve 1.0
 */
 
global $currentpageid;
$currentpageid = get_the_ID();

get_header(); ?>

	<?php if($is_iphone) { ?>
    		<style>
				#main { width:1040px;float:left;margin:0px; }
			</style>
    <?php } ?>

	<style>
		.yarpp-related { display:none; }
	</style>

	<div id="primary" class="site-content">
		<div id="content" role="main">
        
        	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
				<header class="entry-header">
					<h1 class="entry-title"><?php the_title(); ?></h1>
                    <?php include 'social-block.php'; ?>
				</header>

				<?php the_content(); ?>
                
				<?php
	$documents = new WP_Query('post_type=document&posts_per_page=-1'); ?>
    <table width="100%" cellpaddig="0" cellspacing="0" border="0" style="font-size:11px;">
        <tr>
            <td style="font-size:15px;font-weight:bold;padding-top:10px;padding-bottom:10px;padding-left:10px;color:#ffffff;background:#263692;">Name</td>
            <td style="font-size:15px;font-weight:bold;padding-top:10px;padding-bottom:10px;color:#ffffff;background:#263692;">Document Type</td>
            <td style="font-size:15px;font-weight:bold;padding-top:10px;padding-bottom:10px;color:#ffffff;background:#263692;">Product SKU(s)</td>
            <td style="font-size:15px;font-weight:bold;padding-top:10px;padding-bottom:10px;color:#ffffff;background:#263692;">Brand</td>
        </tr>
	<?php while ($documents->have_posts()) : $documents->the_post(); ?>
    
        <tr>
            <td style="height:20px;vertical-align:middle;padding-top:5px;padding-bottom:5px;padding-left:10px;border-bottom:#cccccc 1px solid;"><a href="<?php the_permalink(); ?>" target="_blank"><?php the_title(); ?></a></td>
            <td style="height:20px;vertical-align:middle;padding-top:5px;padding-bottom:5px;border-bottom:#cccccc 1px solid;"><?php the_field('documenttype'); ?></td>
            <td style="height:20px;vertical-align:middle;padding-top:5px;padding-bottom:5px;border-bottom:#cccccc 1px solid;">
                
                <?php
                    $posttags = get_the_tags();
                    if ($posttags) {
                        foreach($posttags as $tag) {
                            echo $tag->name . ' ';
                        }
                    }
                ?>
                
            </td>
            <td style="height:20px;vertical-align:middle;padding-top:5px;padding-bottom:5px;border-bottom:#cccccc 1px solid;"><?php the_field('productbrand'); ?></td>
        </tr>
        
    <?php endwhile ?>
    </table>
<?php wp_reset_postdata(); ?>
                
			</article>

		</div><!-- #content -->
        
	</div><!-- #primary -->
    
<?php get_sidebar(); ?>

<?php get_footer(); ?>